import type { CoolConfig, OSSConfig } from '@cool-midway/core'
import { MODETYPE } from '@cool-midway/core'
import type { MidwayConfig } from '@midwayjs/core'
import * as fsStore from '@cool-midway/cache-manager-fs-hash'

export default {
  // use for cookie sign key, should change to your own and keep security
  keys: 'cool-admin for node',
  koa: {
    port: 8001,
  },
  // 模板渲染
  view: {
    mapping: {
      '.html': 'ejs',
    },
  },
  midwayLogger: {
    default: {
      dir: './logs',
    },
  },
  // 文件上传
  upload: {
    fileSize: '200mb',
    whitelist: null,
  },
  // 缓存 可切换成其他缓存如：redis http://midwayjs.org/docs/extensions/cache
  cache: {
    store: fsStore,
    options: {
      path: 'cache',
      ttl: -1,
    },
  },
  cool: {
    file: {
      mode: MODETYPE.CLOUD,
      oss: {
        accessKeyId: 'LTAI5t9KmGfVYT3LTrAbiPG7',
        accessKeySecret: 'JNnb9AfBNTlnZ0kVCMjRTC6rAX7REj',
        bucket: 'zmax-public-js',
        endpoint: 'oss-cn-hangzhou.aliyuncs.com',
        timeout: '3600s',
      } as OSSConfig,
    },
  } as CoolConfig,
} as MidwayConfig
